package com.yixing.tech.entity.po;

import com.yixing.tech.common.base.BasePO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yixing tech
 * at 2022/2/10
 * describe：
 */
@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class ObjModel extends BasePO {

    private String productId;
    private List<Attr> attrs;
    private ArrayList<Action> actions;
    private List<Event> events;
    private List<Param> snapshot;


    @Data
    public static class Attr {
        /**
         * "code": "deviceTime",
         * "format": "yyMMddHHmmss",
         * "length": 6,
         * "sort": 1,
         * "name": "设备时间",
         * "type": "bcd"
         */
        String clazz;
        String code;
        String format;
        int length;
        int sort;
        String name;
        String type;
        String desc;
        List<Attr> children;
    }

    @Data
    public static class Action {
        String funCode;
        String desc;
        String code;
        String type;
        String direction = "0";
        List<Param> params;
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class Param {
        String attr;
        String uiType;
        String desc;
        String uiReference;
        String value;

    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class Event {
        String funCode;
        String desc;
        String returnFunCode;
        String code;
        boolean isActiveWindow;
        boolean isMainFrame;
        List<Param> params;

    }
}
